package com.ywy.dao;

import com.ywy.entity.UserSign;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

/**
 * 用户签到Repository接口
 *
 * @author ywy
 * @date 2022/8/26 9:13
 */
public interface UserSignDao extends JpaRepository<UserSign, Integer>, JpaSpecificationExecutor<UserSign> {
    /**
     * 查询用户今日签到信息
     * @param userId
     * @return
     */
    @Query(value = "select * from sys_user_sign where user_id=?1 and to_days(sign_time) = to_days(now())", nativeQuery = true)
    UserSign getTodaySignByUserId(Integer userId);
}
